<?php
set_time_limit(0);
$root=preg_replace('/cron$/', '', dirname(__FILE__));

require_once($root."inc.config.php");

require_once($root."initialize.php");

if(($db_msg=cron_initialize()) !== true){

	print_r("Connection error");

}else{ 

	$db=$vars["db"];

	
		$t = @mysql_num_rows($r=mysql_query("select d.id,d.ewallet from gg_users s inner join gg_users d on d.ref_left between s.ref_left and s.ref_right inner join gg_member_ewallet_record e on e.uid=d.id and e.descr='Transfer to www.paradise-vegas.net' where s.id=1226"));
		
		if($t<=0)
		{
			print_r("no record");
			exit;
		}
		
		$cdate = date('Y-m-d H:i:s');
		while($user = mysql_fetch_assoc($r))
		{
			$ewallet_balance = $user['ewallet'];
			$ewallet_balance += 200;
			mysql_query("update gg_users set ewallet=".$ewallet_balance." where id=".$user['id']);			
			$sql = "INSERT INTO gg_member_ewallet_record SET uid=".$user['id'].",type='credit',amount=200,bal=".$ewallet_balance.",descr='member request to transfer back 200 from www.paradise-vegas.net to www.frpplc.com',cdate='".$cdate."'";
			mysql_query($sql);			
		}

	print_r("finish");
}
?>